MyGame.s5 = function(game) {
	
	

};


MyGame.s5.prototype = {
    create: function() {
    	
        var that = this;
    	
		console.log('s5-VR')

        game.bg = game.add.image(0,0,'s5_bg');

        

        game.add.tween(game.bg.scale).to({x:2,y:2},2000,Phaser.Easing.Cubic.Out,true,2000)
        game.add.tween(game.bg).to({x:'-130',y:'-850'},2000,Phaser.Easing.Cubic.Out,true,2000).onComplete.add(function(){
            GameUI.touch(320,695,function(){
                game.touch1.kill()
                game.touch2.kill()
                that.scene_small()
            });
        })


        //.onComplete.add(this.scene_small,this)

        

        game.s5_touping = game.add.image(210,457,'s5_touping');
        game.bg.addChild(game.s5_touping);
        game.s5_touping.alpha = 0;


        game.s5_text = game.add.image(530,360,'s5_text');
        game.bg.addChild(game.s5_text);
        game.s5_text.alpha = 0;





        

        GameUI.cutscenes()
        

       

    },


    scene_small : function(){
        game.add.tween(game.bg.scale).to({x:1,y:1},1000,Phaser.Easing.Cubic.Out,true,0)
        game.add.tween(game.bg).to({x:0,y:0},1000,Phaser.Easing.Cubic.Out,true,0).onComplete.add(this.touping,this)
    },

    touping : function(){
        var that = this;
        game.add.tween(game.s5_touping).to({alpha:1},1000,Phaser.Easing.Cubic.Out,true,0)
        game.add.tween(game.s5_text).to({alpha:1,y:'+10'},1000,Phaser.Easing.Cubic.Out,true,500).onComplete.add(function(){
            loadChart('p5',function(){
                $('#p5').hide();
                setTimeout(function(){
                    $('#p5').find('.chat-content').css({
                        opacity : 1
                    })
                },0)

                that.scene_big()


            })
        },this)
    },

    scene_big : function(){


        //this.scene_big


        game.add.tween(game.bg.scale).to({x:3,y:3},1000,Phaser.Easing.Cubic.Out,true,200)
        game.add.tween(game.bg).to({x:'-1400',y:'-900'},1000,Phaser.Easing.Cubic.Out,true,200).onComplete.add(function(){
           game.state.start('s5_1')
        },this)


        GameUI.scenesfadeOut(1000,0)
    },
    

    update: function() {
    	
    	
    	
    },
    
    
    
    render : function(){
    	/*game.obstacles.forEach(function(item){
            game.debug.body(item);
        })
    	game.debug.body(game.player);*/
    }
};

